/*
 * This file is part of NativeAccessHooks.
 *
 * Copyleft 2014 Mark Jeronimus. All Rights Reversed.
 * https://code.google.com/p/nativeaccesshooks/
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with NativeAccessHooks. If not, see <http://www.gnu.org/licenses/>.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.digitalmodular.nah.mouse;

import com.digitalmodular.nah.NativeHook;

/**
 * The native event generated when a mouse wheel has been rotated (or rocked, for tilting wheels). The event is passed to every
 * {@link NativeMouseWheelListener} object which registered to receive these events.
 * 
 * @author Mark Jeronimus
 * @since 1.0
 */
// date 2014-08-23
public class NativeMouseWheelEvent extends NativeMouseMotionEvent {
	public static enum NativeMouseWheel {
		/** The vertical scroll wheel. */
		Vertical,
		/** The horizontal scroll wheel. On some mice, this may be the sideways rocking action of the vertical scroll wheel. */
		Horizontal;
	}

	/** The mouse wheel associated with this event. */
	private final NativeMouseWheel	wheel;
	/** The amount that the mouse wheel was rotated (the number of "clicks"). */
	private final int				wheelRotation;

	/**
	 * Instantiates a new {@link NativeMouseWheelEvent} object.
	 * 
	 * @param source The source of the event.
	 * @param time The time the event occurred.
	 * @param nanoTime The nanoTime value of the virtual machine at the time the event occurred.
	 * @param x The x coordinate of the native pointer.
	 * @param y The y coordinate of the native pointer.
	 * @param wheel The mouse wheel associated with this event.
	 * @param wheelRotation The amount that the mouse wheel was rotated (the number of "clicks")
	 */
	public NativeMouseWheelEvent(final NativeHook source, final long time, final long nanoTime, final int x, final int y,
			final NativeMouseWheel wheel, final int wheelRotation) {
		super(source, time, nanoTime, x, y);

		this.wheel = wheel;
		this.wheelRotation = wheelRotation;
	}

	/**
	 * Returns the mouse wheel associated with this event.
	 * 
	 * @return
	 */
	public NativeMouseWheel getWheel() {
		return wheel;
	}

	/**
	 * Returns the amount that the mouse wheel was rotated (the number of "clicks").
	 * 
	 * @return
	 */
	public int getWheelRotation() {
		return wheelRotation;
	}

	@Override
	public String toString() {
		StringBuilder message = new StringBuilder(getClass().getSimpleName()).append("[");
		message.append(super.toString());
		message.append(", wheel=").append(wheel);
		message.append(", wheelRotation=").append(wheelRotation);
		return message.append("]").toString();
	}
}
